VERSION 5.00
Begin VB.Form frmTake 
   Caption         =   "Take Incidences"
   ClientHeight    =   5490
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6450
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Moveable        =   0   'False
   ScaleHeight     =   5490
   ScaleWidth      =   6450
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton cmdClose 
      Caption         =   "Close"
      Height          =   615
      Left            =   4200
      TabIndex        =   5
      Top             =   4560
      Width           =   1815
   End
   Begin VB.CommandButton cmdTake 
      Caption         =   "Take"
      Enabled         =   0   'False
      Height          =   615
      Left            =   240
      TabIndex        =   4
      Top             =   4560
      Width           =   1815
   End
   Begin VB.ComboBox comIncidence 
      Height          =   315
      Left            =   1920
      TabIndex        =   3
      Text            =   "Select a incidence"
      Top             =   360
      Width           =   1815
   End
   Begin VB.TextBox txtDesc 
      Height          =   2775
      Left            =   240
      Locked          =   -1  'True
      TabIndex        =   2
      Top             =   1560
      Width           =   5775
   End
   Begin VB.Label lblDesc 
      AutoSize        =   -1  'True
      Caption         =   "Description"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   240
      TabIndex        =   1
      Top             =   960
      Width           =   1440
   End
   Begin VB.Label lblIncidence 
      AutoSize        =   -1  'True
      Caption         =   "Incidence"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   240
      TabIndex        =   0
      Top             =   360
      Width           =   1245
   End
End
Attribute VB_Name = "frmTake"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdClose_Click()
    Me.Hide
End Sub

Private Sub cmdTake_Click()
    Dim connector As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    connector.CursorLocation = adUseClient
    connector.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
    & "SERVER=127.0.0.1;" _
    & "DATABASE=incidences;" _
    & "UID=root;" _
    & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
    connector.Open
    rs.ActiveConnection = connector
    rs.CursorType = adOpenDynamic
    rs.CursorLocation = adUseClient
    rs.LockType = adLockOptimistic
    rs.Open ("update incidences set Coordinator='" & frmLogin.txtLogin.Text & "' where ID_Incidence=" & Me.comIncidence.Text)
    MsgBox ("You have now this incidence")
End Sub

Private Sub comIncidence_Click()
    Me.cmdTake.Enabled = True
    Dim connector As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    connector.CursorLocation = adUseClient
    connector.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
    & "SERVER=127.0.0.1;" _
    & "DATABASE=incidences;" _
    & "UID=root;" _
    & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
    connector.Open
    rs.ActiveConnection = connector
    rs.CursorType = adOpenDynamic
    rs.CursorLocation = adUseClient
    rs.LockType = adLockOptimistic
    rs.Open ("select ID_Incidence, Description from incidences where ID_Incidence='" & Me.comIncidence.Text & "'")
    Me.txtDesc.Text = rs.Fields(1).Value
End Sub

Private Sub Form_Load()
    Dim connector As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    connector.CursorLocation = adUseClient
    connector.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
    & "SERVER=127.0.0.1;" _
    & "DATABASE=incidences;" _
    & "UID=root;" _
    & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
    connector.Open
    rs.ActiveConnection = connector
    rs.CursorType = adOpenDynamic
    rs.CursorLocation = adUseClient
    rs.LockType = adLockOptimistic
    rs.Open ("select ID_Incidence, Description from incidences where Coordinator is NULL")
    While Not rs.EOF
        Me.comIncidence.AddItem (rs.Fields(0).Value)
        rs.MoveNext
    Wend
End Sub

